package src.Packets;

import src.Util.Stream;
import src.Players.*;
import src.Main;

public class ObjectClick2
{

    /*
    * make sure to document EVERY coordinate to go with each object.
    * This will prevent people from spawning an object client side and actually using it.
    * So make sure to include with the id, objectX == # && objectY == #
    */

    public ObjectClick2(Player p)
    {
        if(p == null || p.inStream == null)
        {
            return;
        }
        if(!p.objectClick2)
        {
            p.clickId = p.inStream.readUnsignedWordBigEndianA();
            p.clickY = p.inStream.readSignedWordBigEndian(); 
            p.clickX = p.inStream.readUnsignedWordA();
            p.objectClick2 = true;
        }
        if(Main.m.ge.getDistance(p.clickX, p.clickY, p.absX, p.absY) > 1)
        {
            return;
        }
        p.objectClick2 = false;
        switch(p.clickId)
        {
	    case 2213:   
	    case 2214:
	    case 3045:
	    case 5276:
	    case 6084:
		if(p.skillDelay == 0) {
	   	p.frame.showInterface(p, 5292, 5063);
                p.frame.resetItems(p, 5064);
                p.frame.resetBank(p);
		p.skillDelay = 30;
		}
	    break; 

            default:
                Main.m.log("[" + p.playerIndex + "-" + p.username + "] Object2 click " + p.clickId + ", x = " + p.clickX + ", y = " + p.clickY);
            break;
        }
    }
}